#ifndef PROCESSTHREAD_H
#define PROCESSTHREAD_H

//QT
#include <QThread>
#include <QSslSocket>

//Libraries
#include "loggedusers.h"

class ProcessThread : public QThread
{
    Q_OBJECT

public:
    ProcessThread(int socketDescriptor, LoggedUsers *loggedUsers, QObject *parent);

    void run();

signals:
    void error(QTcpSocket::SocketError socketError);
    void dummySendMsgSignal(int fromUserId, QString message);

public slots:
    void sendMsg(int fromUserId, QString message);

private slots:
    void setup();
    void OnReadyRead();
    void OnDisconnected();


private:
    void socketWrite(QByteArray data);


    int userId;
    int socketDescriptor;
    QSslSocket *socket;
    LoggedUsers *loggedUsers;
};

#endif // PROCESSTHREAD_H
